# Contributor: j.r <j.r@jugendhacker.de>
# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=telegram-tdlib
pkgver=1.8.0
pkgrel=0
pkgdesc="Cross-platform library for building Telegram clients"
url="https://core.telegram.org/tdlib"
arch="all !s390x" # fails to build on big-endian
license="BSL-1.0"
options="!check" # No test suite from upstream
makedepends="cmake openssl-dev zlib-dev gperf linux-headers"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
_commit=7d41d9eaa58a6e0927806283252dc9e74eda5512
source="$pkgname-$pkgver.tar.gz::https://github.com/tdlib/td/archive/$_commit.tar.gz"
builddir="$srcdir/td-$_commit"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX:PATH=/usr

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -m644 -D -t "$pkgdir/usr/share/licenses/$pkgname" \
		LICENSE_1_0.txt
	install -m644 -D -t "$pkgdir/usr/share/doc/$pkgname" \
		README.md
}

sha512sums="
f9937362a307bf7f345630f14d00540a7eb05a6c1fcb9d5671e609c2142a73e587432348c61102eda9e748f5b2aef0b1bd2abf73419e4839ad6bd9fe11877dae  telegram-tdlib-1.8.0.tar.gz
"
